package marmalius;


public class ObjectsUsed {
    public int absY = 0;
    public int absX = 0;
    public int objectY = 0;
    public int objectX = 0;

    public boolean useObject(int objectID, int ID) {
        client p = (client) PlayerHandler.getInstance().getPlayer(ID);
        //client c = (client) PlayerHandler.getInstance().players[ID];
        //int l = c.absX;
        //int i1 = c.absY;
        //int j = c.absX;
        //int k = c.absY;
        //boolean GoFalse = false;

        p.skillX = objectX;
        p.skillY = objectY;
        switch (objectID) {
	        // ------------------tj007razor: mining------------------------
	        case 453: // "mining" empty ore
	        case 452: // "mining" empty ore
	        case 451: // "mining" empty ore
	        case 450: // "mining" empty ore
	            p.sendMessage("There is no ore left in this rock.");
	            p.actionTimer = 6;
	            break;

	        /**
	         *startMine(rock index, level requirement, item to add, XP multiplier, objectID, objectX, objectY);
	         **/
	 
	        case 2090:
	        case 2091: // mining bronze ore, first rock type [0]
	            if (p.actionTimer <= 0) {
	                p.startMine(0, 0, 436, 2, 2091, p.objectX, p.objectY);
	                p.actionTimer = 6;
	            }
	            break;

	        case 2092:
	        case 2093: // mining iron ore, second rock type [1]
	            if (p.actionTimer <= 0) {
	                p.startMine(1, 20, 440, 3, 2093, p.objectX, p.objectY);
	                p.actionTimer = 6;
	            }
	            break;

	        case 2096:
	        case 2097: // mining steel ore, third rock type [2]
	            if (p.actionTimer <= 0) {
	                p.startMine(2, 30, 453, 5, 2097, p.objectX, p.objectY);
	                p.actionTimer = 6;
	            }
	            break;

	        case 2102:
	        case 2103: // mining mith ore, forth rock type [3]
	            if (p.actionTimer <= 0) {
	                p.startMine(3, 55, 447, 8, 2103, p.objectX, p.objectY);
	                p.actionTimer = 6;
	            }
	            break;

	        case 2104:
	        case 2105: // mining addy ore, fifth rock type [4]
	            if (p.actionTimer <= 0) {
	                p.startMine(4, 75, 449, 14, 2105, p.objectX, p.objectY);
	                p.actionTimer = 6;
	            }
	            break;

	        case 2106:
	        case 2107: // mining rune ore, sixth rock type [5]
	            if (p.actionTimer <= 0) {
	                p.startMine(5, 85, 451, 20, 2107, p.objectX, p.objectY);
	                p.actionTimer = 6;
	            }
	            break;

	        case 2111: // mining elemental(dragon) ore, seventh rock type [6]
	            if (p.actionTimer <= 0) {
	                p.startMine(6, 80, 2892, 30, 2111, p.objectX, p.objectY);
	                p.actionTimer = 6;
	            }
	            break;

	        case 2108:
	        case 2109: // mining elemental(dragon) ore, seventh rock type [6]
	            if (p.actionTimer <= 0) {
	                p.startMine(6, 0, 1436, 35, 2109, p.objectX, p.objectY);
	                p.actionTimer = 6;
	            }
	            break;

	        // ------------------------end mining----------------------
	        case 8143:
	            if (server.Farming.herbType == 1) {
	                server.Farming.pickHerbs("Guam leaf", 249, p.playerId, 15);
	            } else if (server.Farming.herbType == 2) {
	                server.Farming.pickHerbs("Marrentill", 251, p.playerId, 20);
	            } else if (server.Farming.herbType == 3) {
	                server.Farming.pickHerbs("Tarromin", 253, p.playerId, 25);
	            } else if (server.Farming.herbType == 4) {
	                server.Farming.pickHerbs("Harralander", 255, p.playerId, 30);
	            } else if (server.Farming.herbType == 5) {
	                server.Farming.pickHerbs("Ranarr", 257, p.playerId, 37);
	            } else if (server.Farming.herbType == 6) {
	                server.Farming.pickHerbs("Toadflax", 2998, p.playerId, 42);
	            } else if (server.Farming.herbType == 7) {
	                server.Farming.pickHerbs("Irit", 259, p.playerId, 49);
	            } else if (server.Farming.herbType == 8) {
	                server.Farming.pickHerbs("Avantoe", 261, p.playerId, 54);
	            } else if (server.Farming.herbType == 9) {
	                server.Farming.pickHerbs("Kwuarm", 263, p.playerId, 60);
	            } else if (server.Farming.herbType == 10) {
	                server.Farming.pickHerbs("Snapdragon", 3000, p.playerId, 67);
	            } else if (server.Farming.herbType == 11) {
	                server.Farming.pickHerbs("Cadantine", 265, p.playerId, 71);
	            } else if (server.Farming.herbType == 12) {
	                server.Farming.pickHerbs("Lantadyme", 2481, p.playerId, 76);
	            } else if (server.Farming.herbType == 13) {
	                server.Farming.pickHerbs("Dwarf-Weed", 267, p.playerId, 81);
	            } else if (server.Farming.herbType == 14) {
	                server.Farming.pickHerbs("Torstol", 269, p.playerId, 90);
	            }
	            break;

	        case 8466:
	            server.Farming.checkHealth("Oak", 1200, p.playerId);
	            break;

	        case 10284:
	            if (p.killCount < 10) {
	                p.sendMessage(
	                        "You need atleast 10 kills to get the lowest reward.");
	            } else if (p.killCount <= 10) {
	                p.addItem(Item4.randomBarrow1(), 1);
	                p.addItem(Item4.randomBarrow1(), 1);
	                p.addItem(Item4.randomRune(), misc.random(100));
	                p.killCount = 0;
	                p.sendMessage("You open the chest and get a reward.");
	            } else if (p.killCount > 10 && p.killCount <= 29) {
	                p.addItem(Item4.randomBarrow2(), 1);
	                p.addItem(Item4.randomBarrow2(), 1);
	                p.addItem(Item4.randomRune(), misc.random(200));
	                p.killCount = 0;
	                p.sendMessage("You open the chest and get a reward.");
	            } else if (p.killCount > 30 && p.killCount <= 39) {
	                p.addItem(Item4.randomBarrow3(), 1);
	                p.addItem(Item4.randomBarrow3(), 1);
	                p.addItem(Item4.randomRune(), misc.random(300));
	                p.killCount = 0;
	                p.sendMessage("You open the chest and get a reward.");
	            } else if (p.killCount >= 40 && p.killCount <= 49) {
	                p.addItem(Item4.randomBarrow4(), 1);
	                p.addItem(Item4.randomBarrow4(), 1);
	                p.addItem(Item4.randomRune(), misc.random(400));
	                p.killCount = 0;
	                p.sendMessage("You open the chest and get a reward.");
	            } else if (p.killCount >= 50 && p.killCount <= 100) {
	                p.addItem(Item4.randomBarrow5(), 1);
	                p.addItem(Item4.randomBarrow5(), 1);
	                p.addItem(Item4.randomRune(), misc.random(500));
	                p.killCount = 0;
	                p.sendMessage("You open the chest and get a reward.");
	            }
	            break;
        }

        /* Woodcutting*/
        if (objectID == 14315) {
            p.sendMessage("Being fixed.");
        }
        if (objectID == 3192) {
            p.godswordMenu();
        }
        if (objectID == 4408) {
            p.teleportToX = 2478;
            p.teleportToY = 4956;
        }
        /*
        if (objectID == 9398) {
            p.openUpDepBox();
        }
        */
        if (objectID == 13621) {
            if (p.combat < 70)
                p.sendMessage("You need 70 combat to play PestControl.");
            else
            	p.sendMessage("You teleport To Pest Control!");
        }
        if (objectID == 4157) {
            // if (p.playerRights >= 1) {
            if (p.GoodDistance(absX, absY, objectX, objectY, 1) == true) {
                p.teleportToX = 3210;
                p.teleportToY = 3836;
                p.sendMessage("Welcome to the Pk Arena (All vs All) " + p.playerName);
                // }
            }
        }
		/*
		if (objectID == 11338) {
			p.skillX = objectX;
			p.skillY = objectY;
			p.WanneBank = 1;
		}
		*/
        if (objectID == 4151) {
            if (p.playerRights >= 1) {
                if (p.GoodDistance(absX, absY, objectX, objectY, 1) == true) {
                    p.teleportToX = 2991;
                    p.teleportToY = 3944;
                    p.sendMessage(
                            "Welcome to the Private PK Area " + p.playerName);
                }
            }
        }
        if (objectID == 7319) {
            if (p.GoodDistance(absX, absY, objectX, objectY, 1) == true) {
                p.teleportToX = 3200;
                p.teleportToY = 3268;
                p.sendMessage("Welcome to the woodcutting center.");
            }
        }
        if (objectID == 4008) {
            p.refreshPrayerAltar();
        }
        /*
        if (objectID == 14367) {
            p.skillX = objectX;
            p.skillY = objectY;
            p.openUpBank();
        }
        */
        if (objectID == 8553)
            p.farmWeeds = true;
        if (objectID == 2467) {
            if (p.actionTimer == 0) {
                if (p.GoodDistance(absX, absY, objectX, objectY, 1) == true) {
                    p.teleportToX = 3518;
                    p.teleportToY = 3550;
                    p.callUpdates(); 
                    p.actionTimer = 2;
                }
            }
        }
        if (objectID == 7288) {
            if (p.actionTimer == 0) {
                if (p.GoodDistance(absX, absY, objectX, objectY, 1) == true) {
                    p.teleportToX = 3222;
                    p.teleportToY = 3218;
                    p.callUpdates(); 
                    p.actionTimer = 2;
                }
            }
        }
        if (objectID == 7325) {
            if (p.actionTimer == 0) {
                if (p.GoodDistance(absX, absY, objectX, objectY, 1) == true) {
                    p.teleportToX = 3261;
                    p.teleportToY = 2784;
                    p.callUpdates(); 
                    p.actionTimer = 2;
                }
            }
        }

        if (objectID == 14315) // Pest control boat plank
        {
            p.sendMessage("You enter the boat.");
            p.teleportToX = 2661;
            p.teleportToY = 2639;
        }
        if (objectID == 14314) // Pest control boat ladder
        {
            p.sendMessage("You leave the boat.");
            p.teleportToX = 2657;
            p.teleportToY = 2639;
        }
        if (objectID == 8972) {
            if (p.actionTimer == 0) {
                if (p.GoodDistance(absX, absY, objectX, objectY, 1) == true) {
                    p.teleportToX = 2470;
                    p.teleportToY = 3436;
                    p.callUpdates(); 
                    p.actionTimer = 2;
                }
            }
        }
        if (objectID == 7316) {
            if (p.actionTimer == 0) {
                if (p.GoodDistance(absX, absY, objectX, objectY, 1) == true) {
                    p.teleportToX = 2981;
                    p.teleportToY = 3955;
                    p.callUpdates(); 
                    p.actionTimer = 2;
                }
            }
        }

        /* FARMING*/
        if (objectID == 8573)
            p.sendMessage("This patch can grow vegetables and fruits.");

        /* FARMING*/
    
        if (objectID == 2720 || objectID == 2718) // c.Hopper controls
        {
            if (p.Hopper == 0)
                p.sendMessage("There is no wheat in the Hopper!");
            else if (p.Hopper == 1) {
                p.sendMessage("You press the Hopper controlls....");
                p.sendMessage("... The grain slides down the shoot.");
                p.Hopper = 2;
            }
      
        }

        /* FARMING*/
        if (objectID == 8573)
            p.sendMessage("You can grow vegetables here.");

        /* FARMING*/
        if (objectID == 7353) {
            if (p.actionTimer == 0) {
                if (p.GoodDistance(absX, absY, objectX, objectY, 1) == true) {
                    p.teleportToX = 3363;
                    p.teleportToY = 9640;
                    p.actionTimer = 2;
                    p.callUpdates(); 
                }
            }
        }
        if (objectID == 2468) {
            if (p.actionTimer == 0) {
                if (p.GoodDistance(absX, absY, objectX, objectY, 1) == true) {
                    p.teleportToX = 3223;
                    p.teleportToY = 3945;
                    p.actionTimer = 2;
                    p.callUpdates(); 
                }
            }
        }
        if (objectID == 7352) {
            if (p.actionTimer == 0) {
                if (p.GoodDistance(absX, absY, objectX, objectY, 1) == true) {
                    p.teleportToX = 3028;
                    p.teleportToY = 3379;
                    p.actionTimer = 2;
                    p.callUpdates(); 
                }
            }
        }
        if (objectID == 2475) {
            if (p.actionTimer == 0) {
                if (p.GoodDistance(absX, absY, objectX, objectY, 1) == true) {
                    p.teleportToX = 3104;
                    p.teleportToY = 9312;
                    p.sendFrame164(6206);
                    p.sendFrame246(6210, 290, 3102);
                    p.sendFrame126("Welcome to the GodSword MiniGame!", 6207);
                    p.sendFrame126("Click the waiting room portal to play!",
                            6208);
                    p.actionTimer = 2;
                    p.callUpdates(); 
                }
            }
        }
        if (objectID == 2465 && p.actionTimer == 0) {
            if (p.actionTimer == 0) {
                if (p.GoodDistance(absX, absY, objectX, objectY, 1) == true) {
                    p.teleportToX = 3039;
                    p.teleportToY = 4835;
                    p.actionTimer = 2;
                    p.callUpdates(); 
                    p.sendFrame164(6206);
                    p.sendFrame246(6210, 290, 565);
                    p.sendFrame126("Welcome to the runecrafting area!", 6207);
                    p.sendFrame126("You need essence to craft runes!", 6208);
                }
            }
        }
        if (objectID == 4150 && p.actionTimer == 0) {
            if (p.actionTimer == 0) {
                if (p.GoodDistance(absX, absY, objectX, objectY, 1) == true) {
                    p.teleportToX = 3345;
                    p.teleportToY = 3348;
                    p.actionTimer = 2;
                    p.callUpdates(); 
                }
            }
        }
        if (objectID == 2477 && p.actionTimer == 0) {
            if (p.actionTimer == 0) {
                if (p.GoodDistance(absX, absY, objectX, objectY, 1) == true) {
                    p.teleportToX = 3065;
                    p.teleportToY = 3951;
                    p.actionTimer = 2;
                    p.callUpdates(); 
                }
            }
        }
        if (objectID == 2476 && p.actionTimer == 0) {
            if (p.actionTimer == 0) {
                if (p.GoodDistance(absX, absY, objectX, objectY, 1) == true) {
                    p.teleportToX = 2948;
                    p.teleportToY = 9773;
                    p.actionTimer = 2;
                    p.callUpdates(); 
                }
            }
        }
        if (objectID == 7273 && p.actionTimer == 0) {
            if (p.actionTimer == 0) {
                if (p.GoodDistance(absX, absY, objectX, objectY, 1) == true) {
                    p.teleportToX = 3281;
                    p.teleportToY = 2770;
                    p.actionTimer = 2;
                    p.callUpdates(); 
                }
            }
        }
        if (objectID == 2471 && p.actionTimer == 0) {
            if (p.actionTimer == 0) {
                if (p.GoodDistance(absX, absY, objectX, objectY, 1) == true) {
                    p.teleportToX = 2717;
                    p.teleportToY = 9803;
                    p.actionTimer = 2;
                    p.callUpdates(); 
                }
            }
        }
        if (objectID == 733) {
            p.makeGlobalObject(objectX, objectY, 734, 0, 10);
            p.sendMessage("You cut the web and go through ! ");
        } 
       
        if (objectID == 5960) {
            if (p.actionTimer == 0) {
                if (p.GoodDistance(absX, absY, objectX, objectY, 1) == true) {
                    if (!p.teleblock) {
                        p.teleportToX = 3291;
                        p.teleportToY = 3945;
                        p.actionTimer = 2;
                    } else if (p.teleblock) {
                        p.sendMessage(
                                "A magical force stops you from teleporting.");
                    }
                }
            }
        }
        if (objectID == 2472) {
            if (p.actionTimer == 0) {
                if (p.GoodDistance(absX, absY, objectX, objectY, 1) == true) {
                    if (!p.teleblock) {
                        p.teleportToX = 2539;
                        p.teleportToY = 4712;
                        p.actionTimer = 2;
                    } else if (p.teleblock) {
                        p.sendMessage(
                                "A magical force stops you from teleporting.");
                    }
                }
            }
        }
        if (objectID == 7272) {
            if (p.actionTimer == 0) {
                if (p.GoodDistance(absX, absY, objectX, objectY, 1) == true) {
                    p.teleportToX = 3565;
                    p.teleportToY = 3306;
                    p.actionTimer = 2;
                    p.callUpdates(); 
                }
            }
        }
        if (objectID == 6551) {
            if (p.actionTimer == 0) {
                if (p.GoodDistance(absX, absY, objectX, objectY, 1) == true) {
                    p.teleportToX = 2464;
                    p.teleportToY = 10129;
                    p.actionTimer = 2;
                    p.callUpdates(); 
                }
            }
        }
        if (objectID == 2474) {
            if (p.actionTimer == 0) {
                if (p.GoodDistance(absX, absY, objectX, objectY, 1) == true) {
                    p.teleportToX = 3299;
                    p.teleportToY = 3311;
                    p.actionTimer = 2;
                    p.callUpdates(); 
                }
            }
        }
        if (objectID == 2473) {
            if (p.actionTimer == 0) {
                if (p.GoodDistance(absX, absY, objectX, objectY, 1) == true) {
                    p.teleportToX = 2868;
                    p.teleportToY = 9839;
                    p.sendMessage("Be sure to bring TeleGrab runes.");
                    p.actionTimer = 2;
                    p.callUpdates(); 
                    p.sendFrame164(6206);
                    p.sendFrame246(6210, 290, 4214);
                    p.sendFrame126("Welcome to the range training!", 6207);
                    p.sendFrame126("Be sure you have telegrab runes!", 6208);
                }
            }
        }
        if (objectID == 2469) {
            if (p.actionTimer == 0) {
                if (p.GoodDistance(absX, absY, objectX, objectY, 1) == true) {
                    if (!p.teleblock) {
                        p.teleportToX = 3436;
                        p.teleportToY = 3573;
                        p.actionTimer = 2;
                        p.sendFrame164(6206);
                        p.sendFrame246(6210, 290, 1856);
                        p.sendFrame126("You teleport back home!", 6207);
                        p.sendFrame126("Welcome back to the main area!", 6208);
                    } else if (p.teleblock) {
                        p.sendMessage(
                                "A magical force stops you from teleporting.");
                    }
                }
            }
        }
        if (objectID == 2470) {
            if (p.actionTimer == 0) {
                if (p.GoodDistance(absX, absY, objectX, objectY, 1) == true) {
                    p.teleportToX = 2540;
                    p.teleportToY = 4716;
                    p.actionTimer = 2;
                    p.callUpdates(); 
                }
            }
        }
        if (objectID == 2473) {
            if (p.actionTimer == 0) {
                if (p.GoodDistance(absX, absY, objectX, objectY, 1) == true) {
                    p.teleportToX = 2868;
                    p.teleportToY = 9839;
                    p.sendMessage("Be sure to bring TeleGrab runes.");
                    p.actionTimer = 2;
                    p.callUpdates(); 
                }
            }
        }
        if (objectID == 8987) {
            if (p.actionTimer == 0) {
                if (p.GoodDistance(absX, absY, objectX, objectY, 1) == true) {
                    p.teleportToX = 3250;
                    p.teleportToY = 9579;
                    p.actionTimer = 2;
                    p.callUpdates(); 
                }
            }
        }
        if (objectID == 7133) { // nature rift
            if (p.playerHasItem(1436)) {
                if (p.actionTimer == 0) {
                    if (p.GoodDistance(absX, absY, objectX, objectY, 1) == true) {
                        if (p.playerLevel[20] >= 44 && p.playerLevel[20] <= 90) {
                            p.actionTimer = 6;
                            p.startAnimation(791);
                            p.NatureReplace(1436, 561);
                            p.addSkillXP((150 * p.playerLevel[20]), 20);
                        } else if (p.playerLevel[20] >= 91) {
                            p.actionTimer = 6;
                            p.startAnimation(791);
                            p.EssReplace(1436, 561);
                            p.addSkillXP((80 * p.playerLevel[20]), 20);
                        }
                    }
                }
            } else if (p.playerLevel[20] <= 43) {
                p.sendMessage("You need a 44 runecrafting to craft these!");
            } else if (!p.playerHasItem(1436)) {
                p.sendMessage("You need some rune essence to craft runes!");
            }
        }
        if (objectID == 7132) { // cosmic
            if (p.actionTimer == 0) {
                if (p.playerHasItem(1436)) {
                    if (p.GoodDistance(absX, absY, objectX, objectY, 1) == true) {
                        if (p.playerLevel[20] >= 30) {
                            p.actionTimer = 6;
                            p.startAnimation(791);
                            p.EssReplace(1436, 564);
                            p.addSkillXP((150 * p.playerLevel[20]), 20);
                        }
                    }
                }
            } else if (p.playerLevel[20] <= 29) {
                p.sendMessage("You need a 3 runecrafting to craft these!");
            } else if (!p.playerHasItem(1436)) {
                p.sendMessage("You need some rune essence to craft runes!");
            }
        }
        if (objectID == 7141) { // blood
            if (p.playerHasItem(1436)) {
                if (p.actionTimer == 0) {
                    if (p.GoodDistance(absX, absY, objectX, objectY, 1) == true) {
                        if (p.playerLevel[20] >= 70) {
                            p.actionTimer = 6;
                            p.startAnimation(791);
                            p.EssReplace(1436, 4278);
                            p.addSkillXP((150 * p.playerLevel[20]), 20);
                        }
                    }
                }
            } else if (p.playerLevel[20] <= 69) {
                p.sendMessage("You need a 70 runecrafting to craft these!");
            } else if (!p.playerHasItem(1436)) {
                p.sendMessage("You need some rune essence to craft runes!");
            }
        }
        if (objectID == 7129) { // fire
            if (p.playerHasItem(1436)) {
                if (p.actionTimer == 0) {
                    if (p.GoodDistance(absX, absY, objectX, objectY, 1) == true) {
                        if (p.playerLevel[20] >= 15) {
                            p.actionTimer = 6;
                            p.startAnimation(791);
                            p.EssReplace(1436, 554);
                            p.addSkillXP((150 * p.playerLevel[20]), 20);
                        }
                    }
                }
            } else if (p.playerLevel[20] <= 14) {
                p.sendMessage("You need a 15 runecrafting to craft these!");
            } else if (!p.playerHasItem(1436)) {
                p.sendMessage("You need some rune essence to craft runes!");
            }
        }
        if (objectID == 7130) { // earth
            if (p.playerHasItem(1436)) {
                if (p.actionTimer == 0) {
                    if (p.GoodDistance(absX, absY, objectX, objectY, 1) == true) {
                        if (p.playerLevel[20] >= 10) {
                            p.actionTimer = 6;
                            p.startAnimation(791);
                            p.EssReplace(1436, 557);
                            p.addSkillXP((150 * p.playerLevel[20]), 20);
                        }
                    }
                }
            } else if (p.playerLevel[20] <= 9) {
                p.sendMessage("You need a 10 runecrafting to craft these!");
            } else if (!p.playerHasItem(1436)) {
                p.sendMessage("You need some rune essence to craft runes!");
            }
        }
        if (objectID == 7137) { // water
            if (p.playerHasItem(1436)) {
                if (p.actionTimer == 0) {
                    if (p.GoodDistance(absX, absY, objectX, objectY, 1) == true) {
                        if (p.playerLevel[20] >= 5) {
                            p.actionTimer = 6;
                            p.startAnimation(791);
                            p.EssReplace(1436, 555);
                            p.addSkillXP((150 * p.playerLevel[20]), 20);
                        }
                    }
                }
            } else if (p.playerLevel[20] <= 4) {
                p.sendMessage("You need a 5 runecrafting to craft these!");
            } else if (!p.playerHasItem(1436)) {
                p.sendMessage("You need some rune essence to craft runes!");
            }
        }
        if (objectID == 7140) { // mind
            if (p.playerHasItem(1436)) {
                if (p.actionTimer == 0) {
                    if (p.GoodDistance(absX, absY, objectX, objectY, 1) == true) {
                        if (p.playerLevel[20] >= 25) {
                            p.actionTimer = 6;
                            p.startAnimation(791);
                            p.EssReplace(1436, 558);
                            p.addSkillXP((150 * p.playerLevel[20]), 20);
                        }
                    }
                }
            } else if (p.playerLevel[20] <= 24) {
                p.sendMessage("You need a 24 runecrafting to craft these!");
            } else if (!p.playerHasItem(1436)) {
                p.sendMessage("You need some rune essence to craft runes!");
            }
        }
        if (objectID == 7139) { // air
            if (p.playerHasItem(1436)) {
                if (p.actionTimer == 0) {
                    if (p.GoodDistance(absX, absY, objectX, objectY, 1) == true) {
                        if (p.playerLevel[20] >= 0) {
                            p.actionTimer = 6;
                            p.startAnimation(791);
                            p.EssReplace(1436, 556);
                            p.addSkillXP((150 * p.playerLevel[20]), 20);
                        }
                    }
                }
            } else if (p.playerLevel[20] <= 0) {
                p.sendMessage("You need a 0 runecrafting to craft these!");
            } else if (!p.playerHasItem(1436)) {
                p.sendMessage("You need some rune essence to craft runes!");
            }
        }
        if (objectID == 7131) { // body
            if (p.actionTimer == 0) {
                if (p.playerHasItem(1436)) {
                    if (p.GoodDistance(absX, absY, objectX, objectY, 1) == true) {
                        if (p.playerLevel[20] >= 28) {
                            p.actionTimer = 6;
                            p.startAnimation(791);
                            p.EssReplace(1436, 559);
                            p.addSkillXP((150 * p.playerLevel[20]), 20);
                        }
                    }
                }
            } else if (p.playerLevel[20] <= 27) {
                p.sendMessage("You need a 27 runecrafting to craft these!");
            } else if (!p.playerHasItem(1436)) {
                p.sendMessage("You need some rune essence to craft runes!");
            }
        }
        if (objectID == 7138) { // soul
            if (p.playerHasItem(1436)) {
                if (p.actionTimer == 0) {
                    if (p.GoodDistance(absX, absY, objectX, objectY, 1) == true) {
                        if (p.playerLevel[20] >= 82) {
                            p.actionTimer = 6;
                            p.startAnimation(791);
                            p.EssReplace(1436, 566);
                            p.addSkillXP((150 * p.playerLevel[20]), 20);
                        }
                    }
                }
            } else if (p.playerLevel[20] <= 81) {
                p.sendMessage("You need a 82 runecrafting to craft these!");
            } else if (!p.playerHasItem(1436)) {
                p.sendMessage("You need some rune essence to craft runes!");
            }
        }
        if (objectID == 7136) { // death
            if (p.actionTimer == 0) {
                if (p.GoodDistance(absX, absY, objectX, objectY, 1) == true) {
                    p.teleportToX = 3307;
                    p.teleportToY = 3931;
                    p.actionTimer = 2;
                    p.callUpdates(); 
                }
            }
        }
        if (objectID == 2488) { // death
            if (p.playerHasItem(1436)) {
                if (p.actionTimer == 0) {
                    if (p.playerLevel[20] >= 65) {
                        p.actionTimer = 6;
                        p.startAnimation(791);
                        p.EssReplace(1436, 560);
                        p.addSkillXP((150 * p.playerLevel[20]), 20);
                    }
                }
            } else if (p.playerLevel[20] <= 64) {
                p.sendMessage("You need a 65 runecrafting to craft these!");
            } else if (!p.playerHasItem(1436)) {
                p.sendMessage("You need some rune essence to craft runes!");
            }
        }
        if (objectID == 7135) { // law
            if (p.playerHasItem(1436)) {
                if (p.actionTimer == 0) {
                    if (p.GoodDistance(absX, absY, objectX, objectY, 1) == true) {
                        if (p.playerLevel[20] >= 55) {
                            p.actionTimer = 6;
                            p.startAnimation(791);
                            p.EssReplace(1436, 563);
                            p.addSkillXP((150 * p.playerLevel[20]), 20);
                        }
                    }
                }
            } else if (p.playerLevel[20] <= 54) {
                p.sendMessage("You need a 55 runecrafting to craft these!");
            } else if (!p.playerHasItem(1436)) {
                p.sendMessage("You need some rune essence to craft runes!");
            }	
        }		
        if (objectID == 7134) { // chaos
            if (p.playerHasItem(1436)) {
                if (p.actionTimer == 0) {
                    if (p.GoodDistance(absX, absY, objectX, objectY, 1) == true) {
                        if (p.playerLevel[20] >= 35) {
                            p.actionTimer = 6;
                            p.startAnimation(791);
                            p.EssReplace(1436, 562);
                            p.addSkillXP((150 * p.playerLevel[20]), 20);
                        }
                    }
                }
            } else if (p.playerLevel[20] <= 34) {
                p.sendMessage("You need a 35 runecrafting to craft these!");
            } else if (!p.playerHasItem(1436)) {
                p.sendMessage("You need some rune essence to craft runes!");
            }	
        }		
        if (objectID == 6552) {
            if (p.actionTimer == 0) {
                if (p.playerAncientMagics == true) {
                    p.animation(435, absY, absX);
                    p.setSidebarInterface(6, 1151); // magic tab (ancient = 12855);
                    p.playerAncientMagics = false;
                    p.ancients = 0;
                    p.actionTimer = 5;
                } else {
                    p.animation(435, absY, absX);
                    p.setSidebarInterface(6, 12855); // magic tab (ancient = 12855);
                    p.playerAncientMagics = true;
                    p.ancients = 1;
                    p.actionTimer = 5;
                }
            }
        }
        return false;
    }
}
